import router from './index'
import store from '../store/index'
//配置导航守卫
router.beforeEach((to,from,next) => {
    if(to.meta.isLogin){
      if(store.state.user.userinfo.isLogin){
        next()
      }else{
        //即将进入登录界面,存储要访问的路径 目的:登录后跳转到要访问的路径界面
        console.log('to-----',to);
        store.commit('changePath',to.path)
        next('/login')
      }
      
    }else{
      //不需要登录
      next()
    }
  })
  